package com.util;

public class Constant {

	public static final int CMD_LENGTH = 4;
	public static final int USER_ID_LENGTH = 8;
	public static final int GROUP_ID_LENGTH = 8;
	public static final int USER_NAME_LENGTH = 32;
	public static final int USER_PASS_LENGTH = 32;

	public static final int FROM_USER_ID_BEGIN = Constant.CMD_LENGTH;
	public static final int FROM_USER_ID_END = Constant.FROM_USER_ID_BEGIN
			+ Constant.USER_ID_LENGTH;

	public static final int TO_USER_ID_BEGIN = Constant.FROM_USER_ID_END;
	public static final int TO_USER_ID_END = Constant.TO_USER_ID_END
			+ Constant.USER_ID_LENGTH;

	public static final int USER_PASS_BEGIN = Constant.FROM_USER_ID_END;
	public static final int USER_PASS_END = Constant.USER_PASS_BEGIN
			+ Constant.USER_PASS_LENGTH;

	public static final int MIN_MESSAGE_LENGTH = Constant.CMD_LENGTH
			+ Constant.USER_ID_LENGTH;

	public static final String CMD_CREATE = "0001";
	public static final String CMD_CREATE_SUCCESS = "0002";
	public static final String CMD_CREATE_FAILED = "0003";

	public static final String CMD_LOGIN = "0010";
	public static final String CMD_LOGIN_SUCCESS = "0011";
	public static final String CMD_LOGIN_FAILED = "0012";

	public static final String CMD_REGIST = "1111";

	public static final String CMD_LOGOUT = "0020";

	public static final String CMD_SEND_TO_USER = "0030";
	public static final String CMD_SEND_TO_GROUP = "0070";
	public static final String REGISTER_ERROR_MESSAGE = "1001:erro:User name has been used!";
	public static final String REGISTER_SUCCESS_MESSAGE = "1002:succ:Register Succeed!";

	public static final String ADD_TO_HEAD = "0";

	public static String getServerID() {
		StringBuffer serverID = new StringBuffer();
		for (int i = 0; i < Constant.USER_ID_LENGTH; ++i) {
			serverID.append(Constant.ADD_TO_HEAD);
		}
		return serverID.toString();
	}
}
